package com.example.rwq_test.designParttern.multiThread.activeObject;

/**
 * TODO note
 *
 * @author renweiqiang
 * @version 1.0.0
 * @createTime 2022/12/20
 */
public class Servant implements ActiveObject {
    public Result<String> makeString(int count, char fillChar) {
        char[] buffer = new char[count];
        for (int i = 0; i < count; i++) {
            buffer[i] = fillChar;
            try {
                Thread.sleep(100L);
            } catch (InterruptedException e) {

            }
        }
        return new RealResult<String>(new String(buffer));
    }

    public void displayString(String string) {
        try {
            System.out.println("displayString: " + string);
            Thread.sleep(10l);
        } catch (InterruptedException e) {

        }
    }
}
